using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using GoogleEarthClasses.Global;
using GoogleEarthClasses.Data;
using GoogleEarthClasses.Entities;
namespace GoogleEarthClasses.Logic
{
    class LImageData
    {
        public static List<EImageData>  SelectAll()
        {
            DataTable dt = DImageData.SelectAll();
            List<EImageData> images = new List<EImageData>();
            EImageData tempImage;
            foreach (DataRow dr in dt.Rows){
                tempImage = new EImageData(ConvertHelper.ToInt32(dr["ImageId"]),
                                        ConvertHelper.ToDateTime(dr["CreatedOn"]),
                                        ConvertHelper.Tostring(dr["CreatedBy"]),
                                        new EAsset(ConvertHelper.ToInt32(dr["AssetFk"])),

                                        ConvertHelper.Tostring(dr["ContentFormat"]),
                                        ConvertHelper.Tostring(dr["ContentStorageType"]),
                                        ConvertHelper.Tobytearrya(dr["ContentBinary"]),
                                        ConvertHelper.Tostring(dr["ContentPath"]),

                                        ConvertHelper.Tostring(dr["ImageSourceType"]),
                                        ConvertHelper.ToDateTime(dr["ImageSourceTime"]),
                                        ConvertHelper.Tostring(dr["ImageSourceModel"]),
                                        
                                        ConvertHelper.Tolong(dr["Longitude"]),
                                        ConvertHelper.Tolong(dr["Latitude"]),
                                        ConvertHelper.Tolong(dr["Altitude"]));
                images.Add(tempImage);
            }
            return images;
        }
    }
}
